
package com.hlkj.pay.service.order;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import com.hlkj.framework.common.pojo.PageResult;
import com.hlkj.pay.dto.order.OrderPageStatisticsDto;
import com.hlkj.pay.dto.order.PayOrderQueryDto;
import com.hlkj.pay.dto.order.RouterOrderDataDto;
import com.hlkj.pay.infrastructure.model.order.OrderFeeResultDO;
import com.hlkj.pay.infrastructure.model.order.PayOrderDO;

import java.util.List;

/**
 * @author HlpayTeam
 * @date 2024/10/10 15:22
 */
public interface IPayOrderService {

    /**
     * 保存订单数据
     * 
     * @param payOrderDO
     */
    void addPayOrder(PayOrderDO payOrderDO);

    PayOrderDO queryPayOrder(PayOrderQueryDto payOrderQueryDto);

    /**
     * 通过平台订单号查询订单
     * 
     * @param payOrderNo
     * @return
     */
    PayOrderDO queryPayOrder(String payOrderNo);

    PayOrderDO queryPayOrderByInsOrderNo(String payOrderNo);

    PayOrderDO queryPayOrderByChannelOrderNo(String channelOrderNo);

    PayOrderDO queryPayOrderBySn(String sn);

    PayOrderDO queryPayOrderByAutCode(String autCode);

    PayOrderDO queryPayOrderByMchOrderNo(String mchOrderNo);
    /**
     * 通过平台订单号查询订单
     *
     * @param payOrderNo
     * @return
     */
    PayOrderDO queryPayOrderNoCache(String payOrderNo);

    /**
     * 查询微信关联订单
     * @param transactionId
     * @return
     */
    PayOrderDO queryWxAssociatedOrder(String transactionId);

    /**
     * 通过商户订单号查询订单
     *
     * @param merOrderNo
     * @return
     */
    PayOrderDO queryPayOrderByMerOrderNo(String sn, String merOrderNo);


    void updatePayOrder(PayOrderDO updatePayOrderDO);

    /**
     * 
     * @param updatePayOrderDO
     */
    void updatePayOrder(PayOrderDO updatePayOrderDO, String payOrderNo, String sn, String merOrderNo);
    /**
     *
     * @param updatePayOrderDO
     */
    int updatePayOrderStatus(PayOrderDO updatePayOrderDO, String payOrderNo, String sn, String merOrderNo);

    /**
     * 
     * @param payOrderQueryDto
     * @return
     */
    PageResult<PayOrderDO> queryPage(PayOrderQueryDto payOrderQueryDto);

    List<PayOrderDO> queryList(PayOrderQueryDto payOrderQueryDto);

    /**
     *
     * @param payOrderQueryDto
     * @return
     */
    Integer orderCount(PayOrderQueryDto payOrderQueryDto);
    /**
     *
     * @param orderFeeResultDO
     * @return
     */
    void addOrderFeeResult(OrderFeeResultDO orderFeeResultDO);

    /**
     *
     * @param payOrderDO
     */
    void closePayOrder(PayOrderDO payOrderDO);

    /**
     * 根据查询条件进行统计，只统计成功订单
     * @param payOrderQueryDto
     * @return
     */
    OrderPageStatisticsDto queryStaticOrdersPage(PayOrderQueryDto payOrderQueryDto);

    /**
     *
     * @param payOrderQueryDto
     * @return
     */
    RouterOrderDataDto querySuccessOrder(PayOrderQueryDto payOrderQueryDto);

    /**
     *
     * @param payOrderQueryDto
     * @return
     */
    RouterOrderDataDto querySuccessOrderAmount(PayOrderQueryDto payOrderQueryDto);
}
